<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Universal Reader - Demonstration To Display a Feed in Any Format</title>

<style>
	.label
	{
		padding-left:16px;
		margin-left:16px;
	}
	fieldset
	{
		margin:16px;
		padding:8px;
		padding-left:32px;
		border:1px solid #069;
	}

<?php
	include("universal-reader.php");
	$defaultFeed = "http://www.xul.fr/rss.xml";
?>

</style>

<script language="JavaScript">
	var sizelist = [ 5, 10, 15, 20, 25, -1];
	function setSize()
	{
		var options = [ "5", "10", "15", "20", "25", "-1" ];

		var selected = document.rss.idx.selectedIndex;
		var value = options[selected];
		document.rss.size.value = value;
	
	}
</script>
</head>


	
<body bgcolor="#FFFFFF">
<h1>Universal Reader - Demonstration To Display a Feed in Any Format</h1>
<p>This demo makes use of the universal-reader.php library to display an Atom 
  or RSS feed in all versions.<br>
</p>
<FORM name="rss" method="POST" action="universal-reader-demo.php">
<fieldset>
  <p>Give the URL of an Atom, RSS 2.0 ou 1.0 feed 
    <input type="text" name="dyn" size="48" value="<?php echo $defaultFeed; ?>">
  </p>
  <span> Display options &nbsp;&nbsp;Max </span> 
  <select name="idx" size="1" onchange="setSize();">
	<option>5</option>
     <option selected>10</option>
     <option>15</option>
     <option>20</option>
     <option>25</option>
     <option>All</option>
    </select>
    <input type="text" name="size" size="1" maxlength="3" value="10">
  <span class="label">Channel</span> 
  <input type="checkbox" name="channel" value="true" checked>
    <span class="label">Descriptions</span> 
    <input type="checkbox" name="desc" value="true" checked>
    <span class="label">Dates</span>
    
  <input type="checkbox" name="date" value="true">

<p>
	
    <INPUT type="submit" value="Display the feed">
</p>
</fieldset>

</FORM><?php

if (isset( $_POST ))
	$posted= &$_POST ;			
else
	$posted= &$HTTP_POST_VARS ;	

if($posted!= false && count($posted) > 0)
{	
	$url = $posted["dyn"];
	$size = $posted["size"];	
	$channelFlag =$posted["channel"];
	$descFlag = $posted["desc"];
	$dateFlag = $posted["date"];
	if($url != false)
	{
		Universal_Reader($url);		// put the feed into an array	
		echo Universal_Display($size, $channelFlag, $descFlag, $dateFlag);
	}
}
?>
<p>(c) 2007-2011 <a href="http://www.scriptol.com" target="_parent" >Scriptol.com</a> - License 
  Mozilla 1.1.</p>
</body>
</html>
